package chuangya.com.anmi.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import RecycleViewUtil.SunStartBaseAdapter;
import RecycleViewUtil.ViewHolder;
import SunStarUtils.GlideUtil;
import chuangya.com.anmi.R;
import chuangya.com.anmi.databean.HotWorkData;

/**
 * Created by Sun.Star on 2017/6/23.
 */

public class MainHotWordAdapter extends SunStartBaseAdapter {
    public MainHotWordAdapter(Context context, List<?> list) {
        super(context, list);
    }

    @Override
    public int onCreateViewLayoutID(int viewType) {
        return R.layout.main_hot_item;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        HotWorkData data = (HotWorkData) list.get(position);
        TextView date = holder.getTextView(R.id.main_hot_item_date);
        TextView name = holder.getTextView(R.id.main_hot_item_name);
        ImageView img = holder.getImageView(R.id.main_hot_item_image);
        ImageView sign = holder.getImageView(R.id.main_hot_item_sign);
        date.setText(data.getTime());
        name.setText(data.getName());
        GlideUtil.ShowImage(context,data.getImgUrl(),img);
        if(position == 0){
            name.setTextColor(context.getResources().getColor(R.color.colorAccent));
        }else{
            name.setTextColor(context.getResources().getColor(R.color.textBlcak));
        }
        if(data.isRe()){
            sign.setVisibility(View.VISIBLE);
        }else{
            sign.setVisibility(View.GONE);
        }
    }
}
